package com.itc.bi.constant;

import cn.hutool.extra.pinyin.PinyinUtil;

import java.util.HashMap;
import java.util.Map;

public class SystemConstant {
    //数据库建表冗余字段
    public final static String DATABASEREDUNDANCYCOLUMN = "htzyredbi_id";

    //数据库类型
    public final static String DATASOURCE_TYPE_MYSQL = "MYSQL";
    public final static String DATASOURCE_TYPE_GAUSSDB = "GAUSSDB";
    public final static String DATASOURCE_TYPE_PG = "POSTGRESQL";
    public final static String DATASOURCE_TYPE_ORACLE = "ORACLE";


    //数据集预览数据大小
    public final static int DATA_COLLECT_PREVIEW_SIZE = 500;

    public final static String JDBC_SQL_TYPE_TABLE = "table"; //查询表信息
    public final static String JDBC_SQL_TYPE_COLUMN = "column";//查询表字段
    public final static String JDBC_SQL_TYPE_VERSION = "version";//查询数据库版本
    public final static String JDBC_SQL_TYPE_SCHEMA = "schema";//查询schema
    public final static String JDBC_SQL_TYPE_SQL = "sql";//执行sql不分页
    public final static String JDBC_SQL_TYPE_SQL_PAGE = "sqlPage"; //分页查询
    public final static String JDBC_SQL_TYPE_SQL_PAGE_COUNT = "sqlPageCount"; //分页总数
    public final static String JDBC_SQL_TYPE_SQL_COLUMN = "sqlColumn"; //sql表头


    //数据集类型
    public final static String DATA_SET_TYPE_DB = "DB";
    public final static String DATA_SET_TYPE_SQL = "SQL";
    public final static String DATA_SET_TYPE_PYTHON = "PY";
    public final static String DATA_SET_TYPE_EXCEL = "EXCEL";

    //参数类型
    public final static String DATA_TYPE_STRING = "string";
    public final static String DATA_TYPE_NUMBER = "number";
    public final static String DATA_TYPE_DATE = "date";
    public final static String DATA_TYPE_TIMESTAMP = "timestamp";

    public static final Map<String,String> DATA_SET_COLUMN_TYPE_MAP = new HashMap<>();
    static {
        DATA_SET_COLUMN_TYPE_MAP.put("java.lang.Integer",DATA_TYPE_NUMBER);
        DATA_SET_COLUMN_TYPE_MAP.put("java.math.BigInteger",DATA_TYPE_NUMBER);
        DATA_SET_COLUMN_TYPE_MAP.put("java.lang.Long",DATA_TYPE_NUMBER);
        DATA_SET_COLUMN_TYPE_MAP.put("java.lang.Double",DATA_TYPE_NUMBER);
        DATA_SET_COLUMN_TYPE_MAP.put("java.lang.Float",DATA_TYPE_NUMBER);
        DATA_SET_COLUMN_TYPE_MAP.put("java.math.BigDecimal",DATA_TYPE_NUMBER);
        DATA_SET_COLUMN_TYPE_MAP.put("java.lang.String",DATA_TYPE_STRING);
        DATA_SET_COLUMN_TYPE_MAP.put("java.sql.Date",DATA_TYPE_DATE);
        DATA_SET_COLUMN_TYPE_MAP.put("java.sql.Timestamp",DATA_TYPE_DATE);
        DATA_SET_COLUMN_TYPE_MAP.put("java.time.LocalDateTime",DATA_TYPE_DATE);
        DATA_SET_COLUMN_TYPE_MAP.put("java.sql.Time",DATA_TYPE_STRING);
    }

    //过滤组件过滤参数条件
    public final static String FILTER_CONDITION_EQ = "eq";//等于
    public final static String FILTER_CONDITION_NE = "ne";//不等于
    public final static String FILTER_CONDITION_IN = "in";//属于
    public final static String FILTER_CONDITION_NOIN = "noin";//不属于
    public final static String FILTER_CONDITION_LIKE = "like";//包含
    public final static String FILTER_CONDITION_NOLIKE = "nolike";//不包含
    public final static String FILTER_CONDITION_NULL = "null";//空
    public final static String FILTER_CONDITION_NONULL = "nonull";//非空
    public final static String FILTER_CONDITION_GT = "gt";//大于
    public final static String FILTER_CONDITION_GE = "ge";//大于等于
    public final static String FILTER_CONDITION_LT = "lt";//小于
    public final static String FILTER_CONDITION_LE = "le";//小于等于
    public final static String FILTER_CONDITION_BA = "ba";//介于


    public final static String PROCESS_TYPE_PROCESS ="process";
    public final static String PROCESS_TYPE_AGGREGATE ="aggregate";

    public final static String REGEX_CHINESE =".*[\\u4e00-\\u9fa5].*";//中文

    public final static String SUM_ADD="sum";//累计函数
    public final static String SUM_GROUP_ADD="groupSum";//组类累计函数
}
